import pygame
from random import randint
class Gamessprite(pygame.sprite.Sprite):
    #飞机大战    精灵
    def __init__(self,image_name,speed = 1):
        #调用父类初始化方法
        super().__init__()
        self.image = pygame.image.load(image_name)
        self.rect = self.image.get_rect()
        self.rect.x = randint(0,400-self.rect.width)
        self.speed = speed
    def update(self):
        #精灵类在屏幕垂直方向上的移动
        self.rect.y += self.speed
